package com.ldg.rocketmq.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * @Author: Liudao
 * @Date: 2022-09-30-15:08
 * @Description:
 */
@RestController
public class HelloController {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    @RequestMapping("sendMsg")
    public void sendMessage(){
        rocketMQTemplate.convertAndSend("ld-topic","此消息由六道自定义的rocketMQ发送，当前时间：" + LocalDateTime.now());
    }
}
